<#if analyzerReport?? && analyzerReport.model?? && analyzerReport.model?size gt 0>
<script>
	var gridster;
	tipCloseWindowMessage = "报表内容已修改但未保存，请确认离开？" ;
	function reloadModel(url , model){
		loadURL(url,model);
	}
	$(document).ready(function(){
		KeyEvent.init();
		var width = ($("body").width()-10) / 12 ;
		gridster = $(".gridster ul").gridster({
		  widget_base_dimensions: [width, 20],
		  widget_margins: [5, 5],
		  helper: 'clone',
		  resize: {
			enabled: true ,
			stop: function (e, ui, $widget){
				var ser = this.serialize();
				var postdata = "";
				for(i=0 ; i<ser.length ; i++){
					
					if(postdata!=""){
						postdata = postdata+";" ;
					}
					postdata = postdata + ser[i].dataid+","+ser[i].x+","+ser[i].y+","+ser[i].width+","+ser[i].height ;
				}
				loadURLWithTip("/${orgi}/design/analytics/${report.id!''}/position.html?dt="+postdata,'#tempdiv' , null , false);
			}
		  },
		  serialize_params: function($w, wgd) {
			return {
				x: wgd.col,
				y: wgd.row,
				width: wgd.size_x,
				height: wgd.size_y,
				id: $($w).attr('id'),
				dataid: $($w).attr('data-id')
			 };
		  },
		  autogrow_cols: true,
		  draggable: {
			handle: '.design-toolbar',
			stop: function(event, ui){
				var ser = this.serialize();
				var postdata = "";
				for(i=0 ; i<ser.length ; i++){
					
					if(postdata!=""){
						postdata = postdata+";" ;
					}
					postdata = postdata + ser[i].dataid+","+ser[i].x+","+ser[i].y+","+ser[i].width+","+ser[i].height ;
				}
				loadURLWithTip("/${orgi}/design/analytics/${report.id!''}/position.html?dt="+postdata,'#tempdiv' , null , false);
				tipCloseWindow = true ;
			}
		  }
		}).data('gridster');	
	});
</script>
<div id="layout-30_30_30" class="dashboard-layout gridster ready" default-region="region-1">
	<ul style="width: 100%; height: 100%; position: relative;backgroun-color:#FFFFFF;">
		<#if analyzerReport?? && analyzerReport.model??>
		<#list analyzerReport.model as reportModel>
		<li data-row="${reportModel.posy!'1'}" data-col="${reportModel.posx!'1'}" data-sizex="${reportModel.poswidth!'4'}" data-sizey="${reportModel.posheight!'12'}" class="design gs-w" data-id="${reportModel.id}" id="comp_${reportModel.id}" style="padding:0px 0px 3px 2px;display: block; position: absolute; min-width: 100px; min-height: 100px;">
			<#include "model.html"/>
		</li>
		</#list>
		</#if>									
	</ul>
</div>
<#else>
	 <div style="height:100%;width:100%;margin:0 auto;text-align:center;line-height:100%;padding-top:130px;">
		 <a data-toggle="ajax" id="newmodel" data-width="500" data-height="260" href="/${orgi}/design/analytics/${report.id!''}/modeladd.html" style="text-decoration: none;color:#0000cc;"  title="创建一个新的仪表盘">
			<img src="/assets/images/warning.png">
			仪表盘内容为空，点击创建一个新的仪表盘。
		 </a>
	</div>
</#if>
